package cn.edu.lcu.cs.javateaching.io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * <ul>
 * <li>类名不规范：驼峰模式，首字母大写</li>
 * <li>变量命名不规范：缓冲区命名，不合理的缩写简写</li>
 * <li>缓冲区为实例变量，线程不安全，应该下沉为方法的局部变量。</li>
 * </ul>
 * @author 某学生
 *
 */
public class byte_copy {
	private String in;
	private String out;
	private byte[] bys = new byte[1024];
	private int len;
	
	public byte_copy(String in, String out) {
		this.in = in;
		this.out = out;
	}
	
	public void copy() throws IOException {
		FileInputStream fis = new FileInputStream(in);
		FileOutputStream fos = new FileOutputStream(out);
		while((len = fis.read(bys)) != -1) {
			fos.write(bys, 0, len);
		}
		fis.close();
		fos.close();
		
	}
	
}
